import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/Home.vue'
import LoginView from '../views/Login.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL), //不带#的路由模式
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      redirect: '/index', //保证打开网址时自动重定向到首页
      children:[
        {
          path: 'index',
          component: () => import('@/views/index/Index.vue'),
        }
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView
    },
    
  ],
})

export default router
